                    //logs.js
                    //获取应用实例
                    const app = getApp()
                        // const util = require('../../utils/util.js')
                        // const Dialog = require('../../zanui/dialog/dialog');
                    import { msg_add, msg_get, msg_delete, file_uploadone } from "../../utils/request/request_json"
                    Page({
                        data: {
                            content_push_state: false,
                            inputShowText: "",
                            imageList: [],
                            pull_openid: "",
                            allMessageList: "",
                            scrollI: 0,
                            scrollTop:0,
                        },
                        onLoad: function(options) {
                            if (JSON.stringify(options) != "{}") {
                                var pull_openid = options.pull_openid;
                                this.setData({
                                    pull_openid: pull_openid
                                })
                            }
                        },
                        onShow() {
                            this.getMessage(0);
                        },
                        upImageAdd() {
                            var self = this;
                            wx.chooseImage({
                                count: 9,
                                success: (res) => {

                                    res.tempFilePaths.forEach(function(str, idx, arr) {
                                        file_uploadone(str, "key", (res) => {
                                            var data = JSON.parse(res.data).data;

                                            if (self.data.imageList.length < 9) {
                                                self.data.imageList.push(data[0].file_name)
                                            } else {
                                                self.data.imageList.shift();
                                                self.data.imageList.push(data[0].file_name);
                                            }
                                            self.setData({
                                                content_push_state: true,
                                                imageList: self.data.imageList
                                            })
                                        }, () => {})
                                    })
                                },
                                fail: (res) => {
                                }
                            })

                        },
                        addClose() {
                            this.setData({
                                content_push_state: false
                            })
                        },
                        getInpuVal(e) {
                            //获取到input输入的值
                            this.setData({
                                inputShowText: e.detail.value
                            })
                        },
                        clearIndex(e) {
                            var idx = e.target.dataset.idx;
                            var data = this.data.imageList.splice(idx, 1);
                            this.setData({
                                imageList: this.data.imageList
                            })
                        },
                        sendMessgae() {
                            var self = this;
                            if(!self.data.inputShowText){
                                wx.showToast({
                                    title: "消息不可为空！",
                                    icon: "none"
                                })
                                return;
                            }
                            var data = {
                                openid: app.globalData.opid,
                                to: this.data.pull_openid,
                                content: this.data.inputShowText,
                                url: self.data.imageList
                            }
                            msg_add(data, function(res) {
                                self.getMessage(0)
                                self.setData({
                                    imageList:[],
                                    inputShowText: "",
                                    content_push_state: false,
                                })
                            }, function(res) {
                            })
                        },
                        getMessage(num) {
                            var self = this;
                            var data = {
                                openid: app.globalData.opid,
                                to: this.data.pull_openid,
                                page: num,
                            }
                            msg_get(data, function(res) {
                                if (res.data.state) {
                                    if (res.data.data) {
                                        if(num == 0){
                                            self.setData({
                                                allMessageList:res.data.data
                                            })
                                        }else{
                                            self.data.allMessageList.msg.concat(res.data.data.msg);
                                            res.data.data.msg.forEach(function(str,idx,arr){
                                                self.data.allMessageList.msg.push(str);
                                            })
                                            self.setData({
                                                allMessageList:self.data.allMessageList
                                            })
                                        }
                                    }
                                    if(num==0){
                                        self.setData({
                                            scrollTop: 0,
                                            scrollI:0
                                        })
                                    }
                                } else {
                                    self.setData({
                                        scrollI: --self.data.scrollI
                                    })
                                    wx.showToast({
                                        title: "没有更多了",
                                        icon: "none"
                                    })
                                }
                            }, function(res) {
                            })
                        },
                        delMessgaeInfo(e) {
                            var self = this;
                            var id = e.currentTarget.dataset.id;
                            var data = {
                                openid: app.globalData.opid,
                                id: id,
                            }
                            wx.showModal({
                                title:"提示",
                                content:"您确定要删除此条聊天记录？删除后,此消息将被永久删除。",
                                success:(res)=>{
                                    console.log(res);
                                    if(res.cancel){
                                        return;
                                    }
                                    msg_delete(data, function(res) {
                                        if (res.data.state) {
                                            self.getMessage(0);
                                        }
                                    }, function(res) {

                                    })
                                }
                            })
                           
                          
                        },
                        changeScrollLower() {
                            var num = ++this.data.scrollI;
                            this.getMessage(num);
                        },
                        textareaInput(val) {
                            this.setData({
                                inputShowText: val.detail.value
                            })
                        },
                        backCheck(){
                            wx.navigateBack({"delta":1})
                        }
                    })